{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Provider\AdminContext #}
{% set ea = ea() %}
{% trans_default_domain null != ea ? ea.i18n.translationDomain : (translation_domain is defined ? translation_domain ?? 'messages') %}

{% set flash_messages = app.flashes %}

{% if flash_messages|length > 0 %}
    <div id="flash-messages">
        {% for label, messages in flash_messages %}
            {% for message in messages %}
                {# the message must be translated outside of the Twig component because
                   the trans_default_domain value is ignored inside the component #}
                {% set translated_message = message|trans %}
                <twig:ea:Alert variant="{{ label }}" withDismissButton>
                    {{ translated_message|raw }}
                </twig:ea:Alert>
            {% endfor %}
        {% endfor %}
    </div>
{% endif %}
